/*
 * author      : dormi330
 * date        : 2018/6/24
 * description :
 */

package com.deep.trade.infrastructure.mybatis.refund;

import com.deep.trade.domain.refund.RefundOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface RefundOrderMapper {

    void insert(@Param("eo") RefundOrder eo);

    int updateStatus(
            // condition
            @Param("tenantCode") String tenantCode,
            @Param("refundOrderId") String refundOrderId,
            @Param("fromVersion") long fromVersion,

            // changed field
            @Param("toStatus") String toStatus,
            @Param("rejectReason") String rejectReason,
            @Param("auditedAt") Date auditedAt,
            @Param("updatedBy") String updatedBy
    );

    List<RefundOrder> listByMember(
            @Param("tenantCode") String tenantCode,
            @Param("memberId") String memberId
    );

    List<RefundOrder> listBySeller(
            @Param("tenantCode") String tenantCode,
            @Param("sellerId") String sellerId
    );

    RefundOrder findOneById(
            @Param("tenantCode") String tenantCode,
            @Param("refundOrderId") String refundOrderId);

    List<RefundOrder> listByTenant(
            @Param("tenantCode") String tenantCode);
}
